from fabric import Connection
import os

def main():
    os.system("cd .. && mvn clean package -Dmaven.test.skip=true")
    c = Connection("root@121.5.109.215")
    with c.cd('/root/rain/lamb-lite/deploy'):
        c.put('../target/lamb-lite-1.0.0.jar', '/root/rain/lamb-lite/target')
        c.put('./docker-compose.yml', '/root/rain/lamb-lite/deploy')
        c.put('./Dockerfile', '/root/rain/lamb-lite/deploy')
        c.put('./start.sh', '/root/rain/lamb-lite/deploy')
        c.run("chmod 777 start.sh && ./start.sh", pty=True)
        c.run("docker ps", pty=True)

if __name__ == '__main__':
    main()
